﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace LocalDataBase
{
    public partial class CreateTaskPage : PhoneApplicationPage
    {
        public CreateTaskPage()
        {
            InitializeComponent();
        }

        private void btnInsert_Click(object sender, RoutedEventArgs e)
        {
            Tasks NewTask = new Tasks();
            NewTask.Description = this.txtDescrition.Text;
            NewTask.DeadLine = this.datePicker.Value ?? DateTime.Now;
            var time = this.timePicker.Value;
            bool bSuccess = TaskHelper.AddTask(NewTask);
            if (bSuccess)
            {
                MessageBox.Show("Insert Task Successful!");
                this.txtDescrition.Text = "";
                this.datePicker.Value = DateTime.Now;
            }
            else
            {
                MessageBox.Show("Insert Failed!");
            }
        }
    }
}